package com.rd.student.jike.class4.xiayinyin.week04.day26;

import java.io.File;

public class Demo03 {
    public static void main(String[] args) {
        String objectPath = System.getProperty("user.dir");
        File file = new File(objectPath + "/" + "file.txt");
        System.out.println(file.getParent());
        File parentFile = file.getParentFile();
        System.out.println(parentFile.getName());
        System.out.println(parentFile.length());
        System.out.println(parentFile);
        System.out.println("-----------");
        String[] strList = parentFile.list();
        for (String s : strList){
            System.out.println(s);
        }
        //重命名
        File file3 = new File(objectPath + "/" + "file3");
        Boolean result = file.renameTo(file3);
        if (result){
            System.out.println("文件夹重命名成功");
        }else {
            System.out.println("文件夹重命名失败");
        }

        //构造方法 （通过父子路径）
        File file3_2 = new File(objectPath,"file3");
        System.out.println(file3_2);
    }
}
